package com.grad.webstudy.model;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Date;

public class CourseComment implements Serializable {
    private Integer id;

    private String content;

    private Integer courseId;

    private Integer courseDetailId;

    private Integer userId;

    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date time=new Date();

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    public Integer getCourseId() {
        return courseId;
    }

    public void setCourseId(Integer courseId) {
        this.courseId = courseId;
    }

    public Integer getCourseDetailId() {
        return courseDetailId;
    }

    public void setCourseDetailId(Integer courseDetailId) {
        this.courseDetailId = courseDetailId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    @Override
    public String toString() {
        return "CourseComment{" +
                "id=" + id +
                ", content='" + content + '\'' +
                ", courseId=" + courseId +
                ", courseDetailId=" + courseDetailId +
                ", userId=" + userId +
                ", time=" + time +
                '}';
    }

    public CourseComment() {
    }

    public CourseComment(Builder builder) {
        this.id = builder.id;
        this.content =builder.content;
        this.courseId =builder.courseId;
        this.courseDetailId =builder.courseDetailId;
        this.userId =builder.userId;
        this.time =builder.time;
    }

    public static class Builder{
        private Integer id;

        private String content;

        private Integer courseId;

        private Integer courseDetailId;

        private Integer userId;

        private Date time=new Date();

        public Builder setId(Integer id) {
            this.id = id;
            return this;
        }

        public Builder setContent(String content) {
            this.content = content;
            return this;
        }

        public Builder setCourseId(Integer courseId) {
            this.courseId = courseId;
            return this;
        }

        public Builder setCourseDetailId(Integer courseDetailId) {
            this.courseDetailId = courseDetailId;
            return this;
        }

        public Builder setUserId(Integer userId) {
            this.userId = userId;
            return this;
        }

        public Builder setTime(Date time) {
            this.time = time;
            return this;
        }

        public CourseComment build(){
            return new CourseComment(this);
        }
    }
}